Extract the querystring logic into separate module: #1600
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
qs
to version 3.0.0 with support for rfc3986 encodingquerystring
modulequerystring
eq
,sep
andoptions
arguments forquerystring
parse
andstringify
methods via option keysI was waiting for this PR ljharb/qs#76 to get in to refactor the
rfc3986
logic in request. Then this bug report #1593 came out, so this PR is fixing both issues.At first I tried using
querystring.escape
for rfc3986 encoding inquerystring.stringify
But that would affect the global namespace so I opted out for standard wrapping.
Next I had to export the
querystring.unescape
out of the Querystring modulebecause it's used in two places in request.js Quick check on the node's code revealed this:
So probably we can use directly
decodeURIComponent
in our context, but then again I chose the safer option.@limbo-lab now you can pass the
sep
,eq
andoptions
arguments to thequerystring
module like this:Let me know what do you think, as there no tests for this behavior yet, and it's not documented in the readme.
Fixes #1593